/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chatsystem;

import java.net.InetAddress;
import java.util.ArrayList;
import javax.swing.DefaultListModel;
import protocol.TalkID;

/**
 *
 * @author Diane
 */
public class Conversation extends DefaultListModel {

    private TalkID tid;
    private ArrayList<User> contributors;

    public Conversation(TalkID tid, ArrayList<User> contributors) {
        this.tid = tid;
        this.contributors = contributors;
    }

    public ArrayList<User> getContributors() {
        return contributors;
    }

    public void setContributors(ArrayList<User> contributors) {
        this.contributors = contributors;
    }

    public TalkID getTid() {
        return tid;
    }

    public void setTid(TalkID tid) {
        this.tid = tid;
    }
    public void addContributor(User u){
        contributors.add(u);
    
    }
    
    public String[] GetContributorsStringAddressList(){
        String[] contributorsIPs = new String[contributors.size()];
        int i = 0;
          for(User u : contributors){
            contributorsIPs[i]= u.getAddress().getHostAddress();
               i++;
          }
          return contributorsIPs;
    
    }
}
